package com.example.jishi.demos.web.service.impl;

import com.example.jishi.demos.web.entity.Employee;
import com.example.jishi.demos.web.mapper.EmployeeMapper;
import com.example.jishi.demos.web.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImpl implements EmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper; // 自动通过构造函数注入

    @Override
    public List<Employee> getAllEmployees(String name) {
        return employeeMapper.getAllEmployees(name);
    }

    @Override
    public Employee getEmployeeById(int id) {
        return employeeMapper.getEmployeeById(id);
    }

    @Override
    public void addEmployee(Employee Employee) {
        employeeMapper.insertEmployee(Employee);
    }

    @Override
    public void updateEmployee(Employee Employee) {
        employeeMapper.updateEmployee(Employee);
    }

    @Override
    public void deleteEmployee(int id) {
        employeeMapper.deleteEmployee(id);
    }
}
